<template>
	<view class="apps">
		<uv-list v-if="list.length > 0">
			<uv-list-item 
				:title="item.title" 
				:note=" timeFormat(item.create_time) " 
				:thumb="item.image" 
				thumb-size="lg" 
				link
				:to="`/pages/notice/detail?id=`+item.id"
				v-for="(item,index) in list">
			</uv-list-item>
		</uv-list>
		<view v-else>
			<uv-empty mode="data"></uv-empty>
		</view>
	</view>
</template>

<script setup>
	import { util } from '/common/util.js';
	import { ref , reactive,nextTick  } from 'vue';
	import { onLoad,onShow,onReachBottom } from '@dcloudio/uni-app'
	import { timeFormat } from '@/uni_modules/uv-ui-tools/libs/function/index.js'
	const list =ref([]),page=ref(1),more=ref(true)
	const getList = ()=>{
		util.request({url:'/notice/index',data:{page:page.value},type:'get'}).then((rlt)=>{
			if(rlt.code == 1){
				if(page.value == 1){
					list.value = rlt.data;
				}else{
					list.vlaue.push(...rlt.data);
				}
				more.value = rlt.data && rlt.data.length == 10
				page.value++
			}
		})
	}
	onLoad(()=>{
		getList()
	})
	onReachBottom(()=>{
		if(more.value){
			getList()
		}
	})
</script>

<style scoped lang="scss">

</style>
